package com.aboverock.module.system.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.aboverock.module.system.domain.Role;
import com.aboverock.module.system.domain.UserRole;

/**
 * <p>
 * Mapper 接口
 * </p>
 * .
 *
 * @author Rock Wang
 * @since 2018-07-31
 */
public interface UserRoleMapper extends BaseMapper<UserRole> {

    /**
     * 根据用户id获取其所属的角色列表.
     *
     * @param userId the user id
     * @return the list
     */
    public List<Role> selectRolesByUserId(String userId);

    /**
     * 获取指定角色id下的所有用户id.
     *
     * @param roleId the role id
     * @return the list
     */
    public List<String> selectUserIdsByRoleId(String roleId);

    /**
     * 删除某个角色与指定用户的user-role关系映射.
     *
     * @param roleId the role id
     * @param userIds the user ids
     * @return the integer
     */
    public Integer removeByRoleIdAndUserIds(@Param("roleId") String roleId, @Param("userIds") List<String> userIds);

    /**
     * 删除指定用户的所有user-role关系映射.
     *
     * @param userIds the user ids
     * @return the integer
     */
    public Integer removeByUserIds(@Param("userIds") List<String> userIds);
}
